package com.xqh.admin.controller.ques;

import com.xqh.admin.commom.BaseController;
import com.xqh.base.util.response.RespMsg;
import com.xqh.base.util.serializer.ObjectUtils;
import com.xqh.entity.ques.QuesModel;
import com.xqh.service.ques.QuesModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * 模块
 */

@Controller
@RequestMapping("/ques/model")
public class QuesModelController extends BaseController{

    @Autowired
    private QuesModelService quesModelService;

    @RequestMapping(value = "list", method = RequestMethod.GET)
    public ModelAndView list(){
        return new ModelAndView("ques/model/ques_model_list");
    }

    @RequestMapping(value = "edit",method = RequestMethod.GET)
    public ModelAndView edit(){
        return new ModelAndView("ques/model/ques_model_edit");
    }

    @RequestMapping(value = "modelData", method = RequestMethod.POST)
    public @ResponseBody RespMsg<?> modelData(QuesModel model){
        List<QuesModel> list = quesModelService.findByBiz(ObjectUtils.changeToMap(model));
        return RespMsg.successResp(list);
    }

}
